<?php

namespace App\Http\Controllers\adminShop;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;

class StatusController extends Controller
{
   public function getStart(Request $request)
   {
       $status = $request -> status;
       $pid = session('pid');
       if($status == 'true') {
         $data = ['shopstatus' => '0'];
          $res = DB::table('shops')->where('id',$pid)->update($data);

        } else {

          $data = ['shopstatus' => '1'];
          $res = DB::table('shops')->where('id',$pid)->update($data);

        }

       if($res) {
            return json_encode(['status' => 0,'msg' => '更新成功']);
       }else{
            return json_encode(['status' => 1,'msg' => '更新失败']);
       }

   }
}
